﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Common
{
   public class ThisAdminSession
    {
        /// <summary>
        /// 用户标识
        /// </summary>
        public static int UserId
        {
            set { HttpContext.Current.Session["UserId"] = value; }
            get
            {
                if (HttpContext.Current.Session["UserId"] == null)
                {
                    return 0;
                }
                else
                {
                    return int.Parse(HttpContext.Current.Session["UserId"].ToString());
                }
            }
        }

        /// <summary>
        /// 登录名
        /// </summary>
        public static string LoginName
        {
            set { HttpContext.Current.Session["LoginName"] = value; }
            get
            {
                if (HttpContext.Current.Session["LoginName"] == null)
                {
                    return null;
                }
                else
                {
                    return HttpContext.Current.Session["LoginName"].ToString();
                }
            }
        }


        /// <summary>
        /// 真实名称
        /// </summary>
        public static string RealName
        {
            set { HttpContext.Current.Session["RealName"] = value; }
            get
            {
                if (HttpContext.Current.Session["RealName"] == null)
                {
                    return null;
                }
                else
                {
                    return HttpContext.Current.Session["RealName"].ToString();
                }
            }
        }
        /// <summary>
        /// 真实名称
        /// </summary>
        public static string Tel
        {
            set { HttpContext.Current.Session["Tel"] = value; }
            get
            {
                if (HttpContext.Current.Session["Tel"] == null)
                {
                    return null;
                }
                else
                {
                    return HttpContext.Current.Session["Tel"].ToString();
                }
            }
        }

        ///// <summary>
        ///// 用户功能权限
        ///// </summary>
        //public static List<UserFunRight> UserFunRight
        //{
        //    set { HttpContext.Current.Session["UserFunRight"] = value; }
        //    get
        //    {
        //        if (HttpContext.Current.Session["UserFunRight"] == null)
        //        {
        //            return null;
        //        }
        //        else
        //        {
        //            return (List<UserFunRight>)HttpContext.Current.Session["UserFunRight"];
        //        }
        //    }
        //}

        ///// <summary>
        ///// 用户功能模块
        ///// </summary>
        //public static List<UserModule> UserModule
        //{
        //    set { HttpContext.Current.Session["UserModule"] = value; }
        //    get
        //    {
        //        if (HttpContext.Current.Session["UserModule"] == null)
        //        {
        //            return null;
        //        }
        //        else
        //        {
        //            return (List<UserModule>)HttpContext.Current.Session["UserModule"];
        //        }
        //    }
        //}

        /// <summary>
        /// 是否系统管理员角色
        /// </summary>
        public static bool IsAdmin
        {
            set { HttpContext.Current.Session["IsAdmin"] = value; }
            get
            {
                if (HttpContext.Current.Session["IsAdmin"] == null)
                {
                    return false;
                }
                else
                {
                    return (bool)HttpContext.Current.Session["IsAdmin"];
                }
            }
        }

    }
}
